package com.yuanchu.order.service;

import com.yuanchu.order.dto.CheckOrderDto;
import com.yuanchu.order.dto.SubmitOrderParamsDto;
import com.yuanchu.order.entity.YoshopGoodsEntity;
import com.yuanchu.order.entity.YoshopOrderEntity;
import com.yuanchu.order.entity.YoshopUserAddressEntity;

import java.util.List;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-02-05 14:07
 */

public interface CheckoutOrderService {

    /**
     * 获取结算订单信息
     *
     * @param params
     * @param userId
     * @return
     */
    Map<String, Object> processCheckoutOrder(SubmitOrderParamsDto params, Integer userId);

    /**
     * 提交订单
     *
     * @param params
     * @param userId
     * @return
     */
    Map<String, Object> checkoutOrderSubmit(SubmitOrderParamsDto params, Integer userId);

    /**
     * 保存订单到数据库
     *
     * @param userId
     * @param delivery
     * @param payType
     * @param remark
     * @param orderDto
     * @param isUsePoints
     * @return
     */
    YoshopOrderEntity saveOrderDb(Integer userId, String delivery, Integer payType, Object remark, CheckOrderDto orderDto, Integer isUsePoints);


    /**
     * 保存订单商品到数据库
     * @param userId
     * @param orderEntity
     * @param goodsList
     */
    void saveOrderGoodsDb(Integer userId, YoshopOrderEntity orderEntity, List<YoshopGoodsEntity> goodsList);
    /**
     * 保存订单地址到数据库
     * @param userId
     * @param orderEntity
     * @param address
     */
    void saveOrderAddressDb(Integer userId, YoshopOrderEntity orderEntity, YoshopUserAddressEntity address);

    /**
     * 提交订单
     * @param userId 用户id
     * @param couponId 优惠券id
     * @param delivery 配送方式
     * @param isUsePoints 是否使用积分
     * @param cartIds 购物车ids
     * @param payType 支付方式
     * @param remark 订备注
     * @return 订单结果
     */
    // Map<String, Object> submitOrder(Integer userId, Integer couponId, String delivery,
    //                                 Integer isUsePoints, String cartIds, Integer payType, String remark);


    /**
     * 创建订单
     * @param userId
     * @param delivery
     * @param isUsePoints
     * @param payType
     * @param remark
     * @param orderDto
     */
    YoshopOrderEntity createOrder(Integer userId, String delivery, Integer isUsePoints, Integer payType, Object remark, CheckOrderDto orderDto);

    /**
     * 获取订单结算数据
     * @param params
     * @param userId
     * @return
     */
    Map<String, Object> checkoutOrder(Map<String, Object> params, Integer userId);

    /**
     * 发送订单支付信息
     * @param userId
     * @param couponId
     * @param orderEntity
     * @param cartIds
     */
    void saveOrderPayMessage(Integer userId, Integer couponId,
                                    YoshopOrderEntity orderEntity, String cartIds);

    /**
     * 提交订单
     * @param params
     * @param userId
     * @return
     */
    Map<String, Object> checkoutGoodsOrderSubmit(SubmitOrderParamsDto params, Integer userId);

    /**
     * 发送订单支付信息
     * @param message
     * @param messageId
     * @param routingKey
     */
    void notifyPayResult(String message, Long messageId, String routingKey);
}
